import { App } from "../Framework/Core/App";

import { BindNode } from "./BindNode";
import { Vector3 } from "./Vec";


/**
 * 包装对象，方便游戏逻辑引擎移植
 */
export class GoWarp
{
    public bindNode:BindNode;
    poolName:string;
    instanceId: number = 0;

    set name(val:string)
    {
        this.bindNode.name = val; 
    }

    get name()
    {
        return this.bindNode.name;
    }


    //复制资源
    public  Instantiate():GoWarp
    {
        return App.Instance.poolMgr.Get(this.poolName);      
    }

    constructor(scrGoInst:BindNode)
    {
        this.bindNode = scrGoInst;
    }

    public SetParent(dstNode:BindNode,stayWorldPos:boolean = false)
    {
        this.bindNode.SetParent(dstNode,stayWorldPos)
    } 

    public SetPosition(v3:Vector3)
    {
        this.bindNode.SetPosition(v3);
    }

    public SetActive(state:boolean)
    {
        this.bindNode.SetActive(state);
    }


    /**
     * 回收节点到对象池内
     */
    public Put()
    {
        App.Instance.poolMgr.Put(this);
    }


}